<h1>Listing user_groups</h1>

<table>
  <tr>
    <th>Name</th>
	<th>Members</th>
  </tr>

<% for user_group in @user_groups %>
  <tr>
    <td><%= link_to h(user_group.name), user_group %></td>
	<td><%= user_group.users.size %></td>
	<td><%= link_to 'Join Group', {:action => :join_to_group, :id => user_group}, :confirm => 'Are you sure?', :method => :post %></td>
	<td><%= link_to 'Leave Group', {:action => :leave_group, :id => user_group}, :confirm => 'Are you sure?', :method => :post %></td>
    <td><%= link_to 'Edit', edit_user_group_path(user_group) %></td>
    <td><%= link_to 'Destroy', user_group, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New user_group', new_user_group_path %>
